﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Shrestha.Trigraph.Graph
{
    public class TriClusterEvent : IComparable<TriClusterEvent>
    {
        private double maxLat;
        private double minLat;
        private double maxLng;
        private double minLng;
        private DateTime maxDate;
        private DateTime minDate;
        private int cluster_id;

        public double MaxLat { get { return maxLat; } }
        public double MinLat { get { return minLat; } }
        public double MaxLng { get { return maxLng; } }
        public double MinLng { get { return minLng; } }
        public DateTime MaxDate { get { return maxDate; } }
        public DateTime MinDate { get { return minDate; } }
        public int ClusterId { get { return cluster_id; } }

        public TriClusterEvent(double maxLat, double minLat, double maxLng, double minLng, DateTime maxDate, DateTime minDate, int cluster_id)
        {
            this.maxLat = maxLat;
            this.minLat = minLat;
            this.maxLng = maxLng;
            this.minLng = minLng;
            this.maxDate = maxDate;
            this.minDate = minDate;
            this.cluster_id = cluster_id;
        }

        public TriEvent MaxEvent { get { return new TriEvent(maxLat, maxLng, maxDate); } }
        public TriEvent MinEvent { get { return new TriEvent(minLat, minLng); } }
        public TriEvent AvgEvent { get { return new TriEvent((maxLat + minLat) / 2, (maxLng + minLng) / 2); } }

        public int CompareTo(TriClusterEvent other)
        {
            if (maxLat == other.maxLat && maxLng == other.maxLng && maxDate == other.maxDate && minLat == other.minLat && minLng == other.minLng && minDate == other.minDate && cluster_id == other.cluster_id) return 0;
            else return 1;
        }
    }
}
